﻿using System;
using System.Collections.Generic;
using System.Linq; 
using NTTDATA.BEENChina.ResultCertification.Config; 

namespace NTTDATA.BEENChina.ResultCertification.Checker.Numeric
{
   
    [Serializable]
    [VerfityAttribute(Id = "VerfityD0006", Name = "通院日期是一个问号时抽出", CategoryType = EnumCategoryType.数值, Model = true)]
    public class VerfityD0006 : VerfityOneResult
    {
 
        public override bool CheckResult(List<List<string>> result, string entryCommon)
        {
            bool bresult = false;

            if (entryCommon.Equals("30"))
            {
                return false;
            }

            if (result == null)
            {
                return false;
            }

            bresult = CheckSpecificCharacter(result, GetSpeicficResult, CheckspecificResult); 

            //foreach (var  rowResult  in result)
            //{

            //    foreach (string colResult in rowResult)
            //    {
            //        var splitResult = new Split.SplitEntryResult(ChildImageObject.CategorySetting.DataFormat, colResult);

            //        bresult = CheckDayEqualQuestionMark(splitResult.GetMd());
            //    }
               
            //}

           

            if (bresult)
            {
                System.Console.WriteLine("VerfityD0006");
            }

            return bresult;
        }

        private   string GetSpeicficResult(string colResult)
        {
            var splitResult = new Split.SplitEntryResult(ChildImageObject.CategorySetting.DataFormat, colResult);
            return splitResult.GetMd();
        }

        protected   bool CheckspecificResult(string result)
        {
        
            bool bresult = false; 


            if (!String.IsNullOrEmpty(result))
            {
                var days = result.Split(new char[] { '.' }).ToList();

                foreach (string day in days)
                {

                    if (day.Equals("?"))
                    {
                        bresult = true;
                    }

                    if (bresult)
                        break;
                }
 
            }
            return bresult;
        }


    }
}
